<?php

class It_Model_Option extends Zend_Db_Table_Abstract
{
    protected $_name = 'option';
    /*
    public function addMultiData($option){
		$query = 'INSERT INTO `option`(userId, name) VALUES '. implode(',', $option);

		$stmt = $this->getAdapter()->prepare($query);
		$stmt->execute();
    }
    */
    public function addData($userId, $name){
        $data = array('userId'=>$userId, 'name'=>$name);
        $this->insert($data);
    }
    public function deleteUserId ($userId)
    {
        $this->delete('userId =' . (int) $userId);  
    }
    public function getOptions ($userId){
		$query = $this->select();
   		$query->from(array('o'=>'option'))
   				->where('userId = ?', $userId);
   		return $this->fetchRow($query);
    }
    public function getOptionView($userId){
		$query = $this->select()
   		           ->from(array('o'=>'option'))
   		           ->where('userId = ?', $userId);
   		return $this->fetchAll($query);
    }
    public function updateOption ($userId, $arrName){
		$dataCheck = array ('name' => $arrName);
       	$this->update($dataCheck, 'userId=' . (int) $userId);
    }
}

























